package org.ndx.majick.ui;

import javax.swing.JComponent;

import org.ndx.majick.properties.Property;

public interface IUIProvider {

	/**
	 * Name suffix for the editor component
	 */
	public static final String EDITOR = ".editor";
	/**
	 * Name suffix for the viewer component
	 */
	public static final String VIEWER = ".viewer";

	/**
	 * Generates and bind UI associated to given source property
	 * @param containerBean used to find which property metadata is associated to the property
	 * @param source source property, which component will be used to render
	 * @return a component allowing edition of source property
	 */
	public abstract JComponent getEditor(Property<?> source);

	public abstract JComponent getViewer(Property<?> source);

	/**
	 * Locates name-level property metadata or (if it exists) instance level property metadata
	 * @param source source property
	 * @return associated metadata
	 */
	public abstract IPropertyUIMetadata getMetadata(Property<?> source);

}